home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / STRFTIM.ZIP / TIMESTAM.C < prev   
Encoding:
C/C++ Source or Header  |  1989-08-29  |  691 b   |  30 lines

  1. /* file timestam.c */
  2.  
  3. /*
  4.     TimeStamp used to create log entries with the current date and time
  5.     from a batch command file. Usually output is redirected to a disk file.
  6.     I use it to log events on my BBS when special processing takes place.
  7.  
  8.     Echo the input command line args with a date & time stamp appended.
  9. */
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <time.h>
  14. #include "strftime.h"
  15.  
  16. main (int argc, char *argv[])
  17. {
  18.     struct tm *now;
  19.     time_t cnow;
  20.     char ts[50];
  21.  
  22.     while (--argc)
  23.         printf("%s ", *++argv);
  24.     time(&cnow);
  25.     now = localtime(&cnow);
  26.     strftime(ts, 49, "%c", now);
  27.     printf(" %s\n", ts);
  28.     return 0;
  29. }
  30.